Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

143
Views
React-native (expo) - "Rechazo no controlado (TypeError): no se pudo recuperar" al usar POST en la recuperación

Mi equipo está desarrollando un sistema de base de datos de inicio de sesión/registro. De acuerdo con algunas guías, generalmente se usa una combinación de props (para establecer estados) y una fetch con POST .

iniciar sesión.js

 export default class App extends Component { state = { usuario: '', setUsuario: '', senha: '', setSenha: '' } async sendForm() { let response = await fetch('http://{My NAT IP}:3000/login', { method: 'POST', headers: { Accept: 'application/json', 'Content-Type': 'application/json' }, body: JSON.stringify({ usuario: '', senha: '' }) })}; render() { return( <View style = { styles.container } > <Text style={styles.titulo}> BOM DENTE </Text> <Image style={styles.logo} source={require('../assets/icon.png')} /> <TextInput style={styles.input} placeholder="Nome de usuário" onChangeText={text => this.state.setUsuario} /> <TextInput style={styles.input} secureTextEntry={true} placeholder="Senha" onChangeText={text => this.state.setSenha} /> <TouchableOpacity style={styles.botao} onPress={() => this.sendForm()} > <Text style={styles.botaoText}> LOGIN </Text> </TouchableOpacity> </View > ) } }

Controlador.js

 const express = require('express'); const cors = require('cors'); const bodyParser = require('body-parser'); const models = require('./models'); const app = express(); app.use(cors()); app.use(bodyParser.urlencoded({ extended: false })); app.use(bodyParser.json()) let user = models.Usuario; app.post('/login', (req, res) => { console.log(req.body) }) let port = process.env.PORT || 3000; app.listen(port, (req, res) => { console.log("Servidor operacional"); })

PD: De acuerdo con este video , expo requiere la IP NAT en la fetch en lugar de localhost .

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!